package com.springbase.demo.controller;

import com.springbase.demo.config.ConfigBean;
import com.springbase.demo.config.ConfigProperties;
import com.springbase.demo.config.FileBean;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.java.Log;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: flyFan
 * @Date: 2021/9/13 20:47
 * @Version: 1.0
 */
@Log
@RestController
@Api(value = "config配置")
@RequestMapping("/config")
public class ConfigController {
	
	@Autowired
	private FileBean fileBean;
	@Autowired
	private ConfigBean configBean;
	@Autowired
	private ConfigProperties configProperties;
	
	@ApiOperation(value = "获取 property ")
	@RequestMapping("/property")
	public void getProperty(){
		log.info(configProperties.getName() + configProperties.getAge());
	}
	
	@ApiOperation(value = "获取 configBean ")
	@RequestMapping("/bean")
	public void getConfigBean(){
		log.info(configBean.getName() + configBean.getAge());
	}
	
	@ApiOperation(value = "通过文件获取配置信息")
	@RequestMapping("/file")
	public void getFileBean(){
		log.info(fileBean.getName() + fileBean.getContent());
	}
}
